Skip to content

feat(database): support creating database configs from a URL - #2315

Merged
brendt merged 3 commits into
tempestphp:3.xfrom
boydbloemsma:feat/database-config-from-url
Oct 29, 2026
Merged

brendt merged 3 commits into
tempestphp:3.xfrom
boydbloemsma:feat/database-config-from-url

Conversation

@boydbloemsma

Copy link
Copy Markdown
Contributor

Fixes #2310

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Benchmark Results

Comparison of feat/database-config-from-url against 3.x (86b06a9455206fef95386d07aa7dd2f9a1e1a6a0).

Open to see the benchmark results

No benchmark changes above ±5%.

Generated by phpbench against commit b58ea88

@aidan-casey aidan-casey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, @boydbloemsma! Thanks for taking this on, I appreciate your work on this.

First, I would recommend we rename this to DatabaseConnectionString, which is the term typically used for this string.

Second (and this is technically a limitation of the existing implementation as well), we need to allow for query parameters within the DSN such as connect_timeout, keepalives, sslmode, etc.

Third, I'd like to see a test case with a Unix socket in the DSN added to this.

Finally, I'd suggest we make this a true value object with methods such as getHost, etc. I'm not sure we should perform the actual validation on the scheme within the VO vs. the config itself.

@brendt

brendt commented Oct 23, 2026

Copy link
Copy Markdown
Member

Agree with Aidan's feedback expect for the getters. Don't add getters but use public readable properties

@boydbloemsma

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback guys!

@brendt
brendt merged commit 809b73b into tempestphp:3.x Oct 29, 2026
78 checks passed
@brendt

brendt commented Oct 29, 2026

Copy link
Copy Markdown
Member

Appreciate it! Nice feature :)

@aidan-casey

Copy link
Copy Markdown
Member

Nice! Thanks, @boydbloemsma!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify connecting to database from connection string / url

3 participants